package com.joy.vo;

import com.joy.model.AssignmentSubmission;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class AssessmentSubDetailVO {
    private String content; // 提交内容
    private String assessment; // 老师评价
    private BigDecimal grade; // 分数
    private String name; // 任务名
    private String type; //任务状态

    public static AssessmentSubDetailVO from(AssignmentSubmission assignmentSubmission) {
        if (assignmentSubmission == null) {
            return new AssessmentSubDetailVO();
        }
        AssessmentSubDetailVO assessmentSubDetailVO = new AssessmentSubDetailVO();
        assessmentSubDetailVO.setContent(assignmentSubmission.getContent());
        assessmentSubDetailVO.setAssessment(assignmentSubmission.getAssessment());
        assessmentSubDetailVO.setGrade(assignmentSubmission.getScore());
        assessmentSubDetailVO.setName(assignmentSubmission.getAssignmentName());
        assessmentSubDetailVO.setType(assignmentSubmission.getStatus());
        return assessmentSubDetailVO;
    }
}
